-- cclog
cclog = function(...)
    print(string.format(...))
end

--gc = {}
--gc.BackGroundLevel = 0
--场景层级
BackGroundLevel = 0--背景
GameBoardLevel = 1--精灵
FlashLevel = 3
MenuLevel = 5
--精灵纹理
ELementImgArray = {
    "images/diamond_red.png",
    "images/diamond_green.png",
    "images/diamond_blue.png",
    "images/candy_red.png",
    "images/candy_green.png",
    "images/candy_blue.png"
}
-- combo标语
ComboTextArray = {
    "Good",
    "Great",
    "Unbelievable"
}
--精灵矩阵数量
RowNum = 8
ColNum = 8

--消除状态的类型与纹理
ElementEliminateType = 10
EliminateStarImg = "images/star.png"

--边距
size = cc.Director:getInstance():getWinSize()
LeftMargin = (size.width - size.height * 9 / 16) / 2
RightMargin = (size.width - size.height * 9 / 16) / 2
BottonMargin = 160
element_size = (size.height * 9 / 16) / ColNum
--游戏地图数据结构
gameBoard = {}

--判断量
isCanTouch = true
require "config"
require "cocos.init"

local function main()
    collectgarbage("collect")

    -- avoid memory leak

    collectgarbage("setpause", 100)
    collectgarbage("setstepmul", 5000)

    cc.FileUtils:getInstance():addSearchPath("src")
    cc.FileUtils:getInstance():addSearchPath("res")

    local director = cc.Director:getInstance()
    director:getOpenGLView():setDesignResolutionSize(960, 640, 0)

    --设置显示帧率
    director:setDisplayStats(true)

    --设置帧率
    director:setAnimationInterval(1.0 / 60)


    --场景
    local scene = require("MainScene")
    --local scene = require("GameScene")
    local gameScene = scene:create()

    if cc.Director:getInstance():getRunningScene() then
        cc.Director:getInstance():replaceScene(gameScene)
    else
        cc.Director:getInstance():runWithScene(gameScene)
    end
end

local status, msg = xpcall(main, __G__TRACKBACK__)
if not status then
    error(msg)
end
